home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Apple Location Manager / ALMInterfaces / LocationManager.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-19  |  6.2 KB  |  227 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        LocationManager.h
  3.  
  4.      Contains:    LocationManager (manange preferences for different physical locations)
  5.  
  6.      Version:    System 7.6
  7.                  Package:    Location Manager SDK 1.0
  8.  
  9.      Copyright:    © 1984-1997 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@apple.com
  16.  
  17. */
  18.  
  19. #ifndef __LOCATIONMANAGER__
  20. #define __LOCATIONMANAGER__
  21.  
  22. #ifndef __APPLEEVENTS__
  23. #include <AppleEvents.h>
  24. #endif
  25. #ifndef __COMPONENTS__
  26. #include <Components.h>
  27. #endif
  28. #ifndef __PROCESSES__
  29. #include <Processes.h>
  30. #endif
  31. #ifndef __DIALOGS__
  32. #include <Dialogs.h>
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT_SUPPORTED
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_ALIGN_SUPPORTED
  44. #pragma options align=mac68k
  45. #endif
  46.  
  47. /*
  48. --------------------------------------------------------------------------------------
  49.  Location token
  50. --------------------------------------------------------------------------------------
  51. */
  52.  
  53. typedef struct OpaqueALMToken* ALMToken;
  54.  
  55. /*
  56. --------------------------------------------------------------------------------------
  57.  Public error codes 
  58. --------------------------------------------------------------------------------------
  59. */
  60.  
  61. enum {
  62.     ALMInternalErr                = -30049,
  63.     ALMLocationNotFound            = -30048,
  64.     ALMNoSuchModuleErr            = -30047,
  65.     ALMModuleCommunicationErr    = -30046,
  66.     ALMDuplicateModuleErr        = -30045,
  67.     ALMInstallationErr            = -30044,
  68.     ALMDeferSwitchErr            = -30043,
  69.     ALMLastErr                    = ALMDeferSwitchErr,
  70.     ALMLastAllocatedErrNum        = -30030
  71. };
  72.  
  73. /*
  74. --------------------------------------------------------------------------------------
  75.  Various parameters 
  76. --------------------------------------------------------------------------------------
  77. */
  78.  
  79. /* ALMConfirmName reports these results */
  80.  
  81. enum {
  82.     ALMConfirmRenameConfig        = 1,
  83.     ALMConfirmReplaceConfig        = 2
  84. };
  85.  
  86. /* ALMSwitchToLocation masks */
  87.  
  88. enum {
  89.     kALMDefaultSwitchFlags        = 0,
  90.     kALMDontShowStatusWindow    = 1,
  91.     kALMSignalViaAE                = 2
  92. };
  93.  
  94. enum {
  95.     kALMLocationNameMaxLen        = 31,
  96.     kALMMaxLocations            = 16,                            /* arbitrary limit.  enforced by LocatioManager.*/
  97.     kALMNoLocationIndex            = -1,                            /* index and token for the 'off' location*/
  98.     kALMNoLocationToken            = -1,
  99.     kAELocationNotice            = 'walk',                        /* Notification AEvent sent to apps when location changes*/
  100.     kALMFileCreator                = 'walk'                        /* creator type of LocatioManager files*/
  101. };
  102.  
  103. /* gestalt selectors */
  104.  
  105. enum {
  106.     gestaltALMVers                = 'walk',
  107.     gestaltALMAttr                = 'trip',
  108.     gestaltALMPresent            = 0
  109. };
  110.  
  111. /*
  112. --------------------------------------------------------------------------------------
  113.  Location-switched notification proc
  114. --------------------------------------------------------------------------------------
  115. */
  116. typedef pascal void (*ALMNotificationProcPtr)(AppleEvent *theEvent);
  117.  
  118. #if GENERATINGCFM
  119. typedef UniversalProcPtr ALMNotificationUPP;
  120. #else
  121. typedef ALMNotificationProcPtr ALMNotificationUPP;
  122. #endif
  123.  
  124. enum {
  125.     uppALMNotificationProcInfo = kPascalStackBased
  126.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AppleEvent *)))
  127. };
  128.  
  129. #if GENERATINGCFM
  130. #define NewALMNotificationProc(userRoutine)        \
  131.         (ALMNotificationUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppALMNotificationProcInfo, GetCurrentArchitecture())
  132. #else
  133. #define NewALMNotificationProc(userRoutine)        \
  134.         ((ALMNotificationUPP) (userRoutine))
  135. #endif
  136.  
  137. #if GENERATINGCFM
  138. #define CallALMNotificationProc(userRoutine, theEvent)        \
  139.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppALMNotificationProcInfo, (theEvent))
  140. #else
  141. #define CallALMNotificationProc(userRoutine, theEvent)        \
  142.         (*(userRoutine))((theEvent))
  143. #endif
  144.  
  145. /*
  146. --------------------------------------------------------------------------------------
  147.  Dispatched trap API
  148. --------------------------------------------------------------------------------------
  149. */
  150. extern pascal OSErr ALMGetCurrentLocation(SInt16 *index, ALMToken *token, Str31 name)
  151.  THREEWORDINLINE(0x303C, 0x0600, 0xAAA4);
  152.  
  153. extern pascal OSErr ALMGetIndLocation(SInt16 index, ALMToken *token, Str31 name)
  154.  THREEWORDINLINE(0x303C, 0x0501, 0xAAA4);
  155.  
  156. extern pascal OSErr ALMCountLocations(SInt16 *nLocations)
  157.  THREEWORDINLINE(0x303C, 0x0202, 0xAAA4);
  158.  
  159. extern pascal OSErr ALMSwitchToLocation(ALMToken newLocation, SInt32 switchFlags)
  160.  THREEWORDINLINE(0x303C, 0x0403, 0xAAA4);
  161.  
  162. extern pascal OSErr ALMRegisterNotifyProc(ALMNotificationUPP notificationProc, const ProcessSerialNumber *whichPSN)
  163.  THREEWORDINLINE(0x303C, 0x0404, 0xAAA4);
  164.  
  165. extern pascal OSErr ALMRemoveNotifyProc(ALMNotificationUPP notificationProc, const ProcessSerialNumber *whichPSN)
  166.  THREEWORDINLINE(0x303C, 0x0405, 0xAAA4);
  167.  
  168. extern pascal OSErr ALMConfirmName(ConstStr255Param msg, Str255 configName, SInt16 *choice, ModalFilterUPP filter)
  169.  THREEWORDINLINE(0x303C, 0x0806, 0xAAA4);
  170.  
  171. /*
  172. --------------------------------------------------------------------------------------
  173.  Location Manager User Module API
  174. --------------------------------------------------------------------------------------
  175. */
  176.  
  177. enum {
  178.     kALMComponentType            = 'walk',                        /* These masks apply to the "flags" field in the ComponentDescription record. */
  179.     kALMMultiplePerLocation        = 1,                            /* this module can be added more than once to a location */
  180.                                                                 /* this module's settings' descriptions can change even */
  181.     kALMDescriptionGetsStale    = 2                                /* when the setting didn't change. */
  182. };
  183.  
  184. typedef UInt32 ALMComponentFlagsEnum;
  185. typedef UInt32 ALMRebootFlags;
  186.  
  187. enum {
  188.                                                                 /* These are the possible values of ALMRebootFlags to be returned in the 'flags' parameter of ALMSetCurrent() */
  189.     kALMNoChange                = 0,
  190.     kALMAvailableNow            = 1,
  191.     kALMFinderRestart            = 2,
  192.     kALMProcesses                = 3,
  193.     kALMExtensions                = 4,
  194.     kALMWarmBoot                = 5,
  195.     kALMColdBoot                = 6,
  196.     kALMShutdown                = 7
  197. };
  198.  
  199. enum {
  200.     kALMScriptInfoVersion        = 2
  201. };
  202.  
  203. struct ALMScriptMgrInfo {
  204.     SInt16                             version;                    /* set to kALMScriptInfoVersion */
  205.     SInt16                             scriptCode;
  206.     SInt16                             regionCode;
  207.     SInt16                             langCode;
  208.     SInt16                             fontNum;
  209.     SInt16                             fontSize;
  210. };
  211. typedef struct ALMScriptMgrInfo ALMScriptMgrInfo;
  212.  
  213. #if PRAGMA_ALIGN_SUPPORTED
  214. #pragma options align=reset
  215. #endif
  216.  
  217. #if PRAGMA_IMPORT_SUPPORTED
  218. #pragma import off
  219. #endif
  220.  
  221. #ifdef __cplusplus
  222. }
  223. #endif
  224.  
  225. #endif /* __LOCATIONMANAGER__ */
  226.  
  227.